
<div class="form_content">
    <header><h3>Image Gallery</h3></header>
    <div class="module_content">
        <?php if($image_deleted):?>
        <div class="error"><?php echo $image_deleted; ?></div>
        <?php endif;?>        
        <!--<form name="galleryform" id="offerform"  action="<?php echo base_url(); ?>secu/gallery/<?php echo $action;?>" method="post" onsubmit="return validateForm()" >-->
        <form enctype="multipart/form-data" id="fupload" method="post" action="<?php echo base_url(); ?>secu/gallery/saveimages/galleryimg">
        <!--<input type="hidden" name="id" id="id" value="<?php// echo $id; ?>">-->
        <fieldset>
            <label style="width: 10%;">Image title </label><input id="image_title" name="image_title" type="text" style="width: 220px;" />
            <label style="width: 10%;">Image </label><input id="userfile" name="userfile" type="file" size="40"/>
        </fieldset>
        <fieldset>
            <label style="width: 23%;">Is Home page Banner (600x320)</label>
            <input type="checkbox" name="ishomebanner" value="1" style="width:20%;">
        </fieldset>
        <!--<div id="container">
            <p id="add_field">
            <a href="#"><span>Add Image to gallery»</span></a>
            </p>
        </div> -->
        <fieldset>
            <input type="submit" name="btn_upload" id="submit" value="SAVE"  >&nbsp;
            <input type="reset" name="reset" id="reset" value="RESET" >
        </fieldset>
        <?php if (isset ($imgerror)) { ?>
            <div class="error"><?php echo $imgerror; ?></div>
            <?php } ?>
        <div class="clear"></div>
        </form>
        
        <div class="clear"></div>
        
        <div class="clear"></div>
        <fieldset style="padding: 5px;">
        <label>Gallery Images</label><br/><br/>
        <?php foreach ($gallery_arr as $key => $val) {?>
            <div class="gallerybox">
                <a class=""  href="<?php echo base_url(); ?>images/uploads/original/<?php echo $val['image'] ?>">
                <div style="height: 85px"><img class="thumb" name="thumb" id="" src="<?php echo base_url(); ?>images/uploads/thumb/thumb_<?php echo $val['image'] ?>"/></div>
                </a>
                <div>
                    <a class="adel" href="<?php echo base_url()?>secu/gallery/deletegalleryimage/name/<?php echo $val['image']; ?>/id/<?php echo $val["id"] ;?>">
                    <img src="<?php echo base_url(); ?>images/admin/icn_trash.png" title="Trash">delete
                    </a>
                </div>
            </div>
        <?php } ?>
        </fieldset>
        <fieldset style="padding: 5px;">
        <label>Banners Images</label><br/><br/>
        <?php foreach ($banner_arr as $key => $val) {?>
            <div class="gallerybox">
                <a class=""  href="<?php echo base_url(); ?>images/uploads/original/<?php echo $val['image'] ?>">
                    <div style="height: 75px"><img class="thumb" name="thumb" id="" src="<?php echo base_url(); ?>images/uploads/thumb/thumb_<?php echo $val['image'] ?>"/></div>
                </a>
                <div>
                    <a class="adel" href="<?php echo base_url()?>secu/gallery/deletegalleryimage/name/<?php echo $val['image']; ?>/id/<?php echo $val["id"] ;?>">
                    <img src="<?php echo base_url(); ?>images/admin/icn_trash.png" title="Trash">delete
                    </a>
                </div>
            </div>
        <?php } ?>
        </fieldset>
        <div class="clear"></div>
        
    </div>



</div>
<script>
    var count = 0;
    $(function(){
        $('p#add_field').click(function(){
            count += 1;
            $('#container').append('<fieldset><label style="width: 10%;">Image title' + count + '&nbsp;</label>'+ '<input id="image_title_' + count + '" name="image_title[]' + '" type="text" style="width: 220px;" /><label style="width: 10%;">Image' + count + '&nbsp;</label>'+ '<input id="userfile_' + count + '" name="userfile[]" type="file" size="40"/></fieldset>' );
        });
    });
        //$( "#offer_start" ).datepicker({dateFormat: "yy-mm-dd"});
        //$( "#offer_end" ).datepicker({dateFormat: "yy-mm-dd"});

</script>



